<template>
  <div>
      <div v-for="item in commentData">
        <div style="margin-left: 5%;margin-top: 5%">
          <div style="height: 3px" />
            <h4 style="display: inline-block">
              {{ item.users.usersName }}
            </h4>
            对我的文章
            <h4 style="display: inline-block">
              <a @click="articleTitle(item.article.articleId)">
                {{ item.article.articleTitle }}
              </a>
            </h4>
            评论了<br><br>
            {{ item.commentContent }}<br><br>
            {{ item.commentCreatingTime }}
          <el-divider></el-divider>
        </div>
      </div>
      <div v-if="commentData.length === 0">
        <el-empty description="暂未有评论哦" />
      </div>
  </div>
</template>

<script>
import request from "../../../utils/request";
import {gotoNewWindow} from "../../../utils/sameMethod";

export default {
  name: "informReplyComment",
  data(){
    return{
      commentData:[],
      users:{}
    }
  },
  methods:{
    articleTitle(articleId){
      gotoNewWindow(articleId,"content","detail");
    },
    initReplyComment() {
      request.get('/comment/selectReplyOneselfComment/' + this.users.usersId).then((res) => {
        this.commentData=res.data;
      })
      }
  },
  created() {
    this.users=JSON.parse(localStorage.getItem("userData"))
  },
  mounted() {
    this.initReplyComment()
  }
}
</script>
